<%
################################################################################
# NOTE: It is STRONGLY suggested that if you wish to customize the look and feel
# of your Helpy, that you create a custom theme instead.  This will allow
# you to override any views or styles you wish to, without compromising your
# ability to upgrade in the future
################################################################################
%>

<ul class="list-unstyled">
<% @results.each do |result| %>
  <% if result.searchable_type == "Topic" %>
  <li class="search-result">
    <span class="more-important"><%= link_to result.searchable.name, topic_posts_path(Topic.find(result.searchable_id)) %></span><br/>
    <span class="result-body less-important"><%= strip_tags result.searchable.post_cache.truncate_words(20) unless result.searchable.post_cache.nil? %></span><br/><br/>
  </li>
  <% else %>
  <li class="search-result">
    <span class="more-important"><%= link_to result.searchable.title, category_doc_path(result.searchable.category_id, Doc.find(result.searchable_id)) %></span><br/>
    <span class="result-body less-important"><%= strip_tags(result.searchable.body.truncate_words(20)) unless result.searchable.body.nil? %></span><br/><br/>
  </li>
  <% end %>
<% end %>
<% if @results.total_count == 0 %>
  <li class="text-center verticalness">
    <%#= t(:no_results) %><br/>
    <%= link_to t(:get_help_button, default: "Start a Discussion with Us"), new_topic_path(q: params[:q] ), class: 'btn btn-primary get-help-button' if forums? || tickets? %>
  </li>
<% end %>
</ul>
<div class="text-center paginate-links">
  <%= paginate @results, :remote => true %>
</div>
